package com.hc.mapper;

import com.hc.domain.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

public interface OrderMapper {
    /**
     * try阶段
     * 添加订单
     */
    @Insert("insert into t_order(account_id,good_id,good_num,order_amount,status) values(#{accountId},#{goodId},#{goodNum},#{orderAmount},#{status})")
    void addOrder(Order order);


    // commit阶段 刷新订单状态

    @Update("update t_order set status = #{status} where id = #{id}")
    void updateOrderStatus(Order order);

    // cancel阶段，删除订单或者将订单状态变成失败
    @Update("delete from t_order where id = #{id}")
    void deleteOrder(Order order);

}